package com.mmww.swagger2.controller;

import com.mmww.swagger2.apimodel.ApiUser;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author rfhu
 * @title: UserController
 * @projectName swagger2
 * @description: TODO
 * @date 2019/08/14 11:18
 */
@Api(value = "用户类控制器",tags="用户类控制器")
@RestController
@RequestMapping(value = "/user")
public class UserController {

    @ApiOperation(value = "获取用户列表",notes = "获取用户列表")
    @RequestMapping(value = "/getUsers", method = RequestMethod.GET)
    public List<ApiUser> getUsers() {
         return new ArrayList<>();
    }

    @RequestMapping(value = "/getById", method = RequestMethod.GET)
    @ApiOperation(value="获取用户详细信息", notes="根据url的id来获取用户详细信息")
    public ApiUser get(@ApiParam(name="id",value="用户id",required=true) Integer id) {
        //log.info("GET..{}...方法执行。。。",id);
        //return userService.getById(id);
        return new ApiUser();
    }

    @RequestMapping(value = "/addUser", method = RequestMethod.POST)
    @ApiOperation(value="创建用户" ,notes="创建用户时的注意事项")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "user", value = "用户实体user", required = true, dataType = "User")
    })
    public void addUser(ApiUser user) {
//        userService.updateById(user);
//        log.info("PUT方法执行。。。");
    }
}
